package icu.cocoon.system.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonProperty.Access;
import icu.cocoon.dao.base.BaseEntity;
import icu.cocoon.system.handler.PasswordHandler;
import io.swagger.annotations.ApiModel;
import java.util.List;
import javax.validation.constraints.NotNull;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

/**
 * <p>
 *
 * </p>
 *
 * @author Larva
 * @since 2020-03-12
 */
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("sys_user")
@ApiModel(value = "User对象", description = "")
public class User extends BaseEntity {

  @NotNull(message = "orgId不允许为空")
  private Long orgId;

  @JsonProperty(access = Access.WRITE_ONLY)
  @TableField(typeHandler = PasswordHandler.class)
  private String password;

  private String name;

  private String phone;

  private String username;

  private String avatarUrl;

  private String mailUsername;

  private String mailPassword;

  @TableField(exist = false)
  private List<Long> roleIds;

}
